package biz.datalk.industrialland.admin.modules.system.pojo.dto;

import biz.datalk.industrialland.common.pojo.po.BasePO;
import biz.datalk.industrialland.common.validated.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @author tarofang@163.com
 * @date 2019-08-19
 */
@Getter
@Setter
@ToString
public class SysUserDTO extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键id, UUID
     * <p>
     * sys_user.id
     */
    @EqualsAndHashCode.Include
    @NotNull(groups = {Update.class}, message = "{user.no.exists.or.delete}")
    private Long id;

    /**
     * 登录账号
     * <p>
     * sys_user.username
     */
    @NotBlank(groups = {Insert.class, Update.class}, message = "{user.username.blank}")
    private String username;

    /**
     * 密码
     * <p>
     * sys_user.password
     */
    @NotBlank(groups = {Insert.class}, message = "{user.password.blank}")
    private String password;

    /**
     * 真实姓名
     * <p>
     * sys_user.realname
     */
    private String realname;

    /**
     * md5密码盐
     * <p>
     * sys_user.salt
     */
    private String salt;

    /**
     * 头像
     * <p>
     * sys_user.avatar
     */
    private String avatar;

    /**
     * 生日
     * <p>
     * sys_user.birthday
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    /**
     * 性别（0：未指定 1：男 2：女）
     * <p>
     * sys_user.sex
     */
    private Integer sex;

    /**
     * 电子邮件
     * <p>
     * sys_user.email
     */
    private String email;

    /**
     * 电话
     * <p>
     * sys_user.phone
     */
    @PhoneValidation(message = "{user.phone.invalid}")
    private String phone;

    /**
     * 部门code
     * <p>
     * sys_user.sys_org_code
     */
    private String sysOrgCode;

    /**
     * 状态(1：正常  2：冻结 ）
     * <p>
     * sys_user.status
     */
    private Integer status;

    /**
     * 删除状态（N-未删除，Y-已删除）
     * <p>
     * sys_user.is_delete
     */
    private String isDelete;


    @NotBlank(groups = {BatchDelete.class, Delete.class}, message = "{user.no.exists.or.delete}")
    private String sysids;

    @NotBlank(groups = {Insert.class, Update.class}, message = "{user.username.blank}")
    private String sysroleids;

    @NotBlank(groups = {Insert.class, Update.class}, message = "{user.username.blank}")
    private String sysorgids;

    /** 确认密码 */
    @NotBlank(groups = {Insert.class}, message = "{user.confpwd.blank}")
    private String confPwd;

}
